package com.aline.seo.controller;

import com.aline.seo.repository.RoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName TestController
 * @Description
 * @Author 孟志浩
 * @Date 2019/4/9 17:17
 **/
@RestController
@RequestMapping("/admin")
public class TestController {

    @Autowired
    RoleRepository roleRepository;

    @GetMapping("/user")
    public Object getUser(HttpServletRequest request){
        return SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    }
}
